$ErrorActionPreference = 'Stop'

Write-Host 'Activating venv...'
& .\.venv\Scripts\Activate.ps1

Write-Host 'Starting backend...'
Start-Process -FilePath powershell -ArgumentList "-NoProfile","-ExecutionPolicy","Bypass","-Command","python scripts/start_server.py" -WindowStyle Hidden

Start-Sleep -Seconds 6

Write-Host 'Probing backend health...'
try {
  $resp = Invoke-WebRequest -UseBasicParsing http://127.0.0.1:8001/health -TimeoutSec 5
  Write-Host ("Backend health: {0}" -f $resp.StatusCode)
} catch {
  Write-Host 'Backend health probe failed'
}

Write-Host 'Starting frontend dev server...'
Push-Location frontend
npm run dev
Pop-Location


